﻿namespace Infra.Validation
{
    using System.Collections.Generic;

    /// <summary>
    /// A collection of validation rules.
    /// </summary>
    /// <typeparam name="TRuleType">The type of the rule.</typeparam>
    public class RulesList<TRuleType> : SortedList<int,TRuleType> 
    {
        #region Rule Comparer

        /// <summary>
        /// Comparer for the rules
        /// </summary>
         internal class RuleComparer : IComparer<int>
         {
            public int Compare(int x, int y)
            {
                if (x > y)
                    return 1;
                else if (x < y)
                    return -1;
                else return 0;
            }
         }

        #endregion

        public RulesList() : base(new RuleComparer())
        {
                
        }
    }
}
